import request from "@/utils/request";
const serverUrl = "/pro-api"
// 获取分享文件信息
export function getShareFileInfo(id: any) {
    return request({
        url: serverUrl+"/share/info/" + id,
        method: "get",
    })
}

// 校验分享密码
export function checkPassword(data: any) {
    return request({
        url: serverUrl+"/share/check",
        method: "post",
        data: data
    })
}

// 获取分享文件列表
export function shareList(token: any, id: any, parentId?: any, topId?: any) {
    return request({
        url: serverUrl+"/share/file_list",
        method: "get",
        params: {
            shareId: id,
            parentId: parentId,
            topId: topId
        },
        headers: {
            "ShareAuthorization": token
        }
    })
}

// 获取分享列表
export function shareFileList() {
    return request({
        url: serverUrl+"/share/list",
        method: "get"
    })
}

// 新增分享
export function insertShare(data: any) {
    return request({
        url: serverUrl+"/share/insert",
        method: "post",
        data: data
    })
}

// 取消分享
export function cancelShare(data: any) {
    return request({
        url: serverUrl+"/share/delete",
        method: "post",
        data: data
    })
}

// 创建分享下载链接
export function createdShareLink(data: any) {
    return request({
        url: serverUrl+"/file/created/sharing/download",
        method: "get",
        params: {
            fileId: data.fileId
        },
        headers: {
            "ShareAuthorization": data.token
        }
    })
}



